<ui:composition xmlns="http://www.w3.org/1999/xhtml"
                xmlns:ui="http://java.sun.com/jsf/facelets"
                template="/WEB-INF/facelets/template.xhtml"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:p="http://primefaces.prime.com.tr/ui"                 
                xmlns:f="http://java.sun.com/jsf/core"
                xmlns:c="http://java.sun.com/jsp/jstl/core">

<ui:param name="title" value="#{msg.profileSettingsTitle}"/>
<ui:define name="headerBar">
    <ui:include src="WEB-INF/facelets/headerBar.xhtml"/>
</ui:define>

<ui:define name="pageContents">    
    <h:form id="settingsForm">
    <h:panelGrid id="settingsPanel" columns="3">
        <h:outputLabel for="settingsEmail" value="#{msg.settingsEmailAddress}" />
            <h:inputText id="settingsEmail" value="#{profileSettingsBackingBean.user.email}"
            required="true" requiredMessage="#{msg.emailCantBeEmpty}">
                <f:validateLength minimum="3" />
                <f:ajax event="blur" render="emailMsg" />
            </h:inputText>
            <p:message id="emailMsg" for="settingsEmail" display="text"/>                
        <h:outputLabel for="settingsPassword" value="#{msg.settingsPasswordOne}" />
        <h:inputSecret id="settingsPassword" value="#{profileSettingsBackingBean.passwordOne}"/>
        <p/>
        <h:outputLabel for="settingsPassword2" value="#{msg.settingsPasswordTwo}" />
        <h:inputSecret id="settingsPassword2" value="#{profileSettingsBackingBean.passwordTwo}"/>
        <p/>
        <f:facet name="footer">
            <p:commandButton value="#{msg.saveProfile}" id="saveProfile" ajax="false"
                  action="#{profileSettingsBackingBean.saveProfile}" />
            <p:commandButton value="#{msg.deleteProfile}" id="deleteProfile" ajax="false"
                  action="#{profileSettingsBackingBean.deleteProfile}" />
        </f:facet>
    </h:panelGrid>
    </h:form>

</ui:define>

<ui:param name="h1" value="#{msg.profileSettingsHeader}: #{profileSettingsBackingBean.user.username}"/>

</ui:composition>